package com.oa.hyperion.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.oa.hyperion.entity.assets.AssetsAllocation;
import com.oa.hyperion.entity.assets.AssetsGeneralLedger;
import com.oa.hyperion.repository.assets.AssetsAllocationMapper;
import com.oa.hyperion.service.AssetsAllocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author yuanchongwei
 * date 2022-1-18
 */
@Service
public class AssetsAllocationServiceImpl implements AssetsAllocationService {
    @Autowired
    private AssetsAllocationMapper assetsAllocationMapper;

    @Override
    public void add(AssetsAllocation assetsAllocation) {
        assetsAllocationMapper.insert(assetsAllocation);
    }

    @Override
    public List<AssetsAllocation> getAllAllocation() {
        return assetsAllocationMapper.getAllAllocation();
    }

    @Override
    public List<AssetsAllocation> getAssetsAllocationByAssetId(int asset_id) {
        return assetsAllocationMapper.getAssetsAllocationByAssetId(asset_id);
    }

    @Override
    public List<AssetsAllocation> getAssetsAllocationByTransferout(int transfer_out) {
        return assetsAllocationMapper.getAssetsAllocationByTransferout(transfer_out);
    }

    @Override
    public List<AssetsAllocation> getAssetsAllocationByTransferin(int transfer_in) {
        return assetsAllocationMapper.getAssetsAllocationByTransferin(transfer_in);
    }

    @Override
    public List<AssetsAllocation> getAssetsAllocationByHandler(String handler) {
        return assetsAllocationMapper.getAssetsAllocationByHandler(handler);
    }

    @Override
    public PageInfo<AssetsAllocation> getByCondition(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<AssetsAllocation> assetsAllocations = assetsAllocationMapper.getAllAllocation();
        return new PageInfo<>(assetsAllocations);
    }
}
